package info.ask4research.service.core;

import java.util.List;

public interface AbstractService<T> {

	/**
	 * Gets an object by id 
	 * @param id PK
	 * @return T
	 */
	public T get(int id);
	/**
	 * Gets a list of all objects
	 * @return List<T>
	 */
	public List<T> getAll();
	/**
	 * Checks the existence of an object by id
	 * @param id PK 
	 * @return boolean
	 */
	public boolean exists(int id);
	/**
	 * Saves an object 
	 * @param object T
	 * @return T
	 */
	public T save(T object);
	/**
	 * Saves a list of objects
	 * @param elements List<T>
	 */
	public void saveAll(List<T> elements);
	/**
	 * Removes all objects
	 */
	public void removeAll();
	/**
	 * Removes all objects
	 * @param elements List<T>
	 */
	public void removeAll(List<T> elements);
	/**
	 * Removes an object
	 * @param id PK
	 */
	public void remove(int id);
	/**
	 * Removes an object
	 * @param entity T
	 */
	public void remove(T entity);
	/**
	 * Checks if an object contains another object
	 * @param object T
	 * @return boolean
	 */
	public boolean contains(T object);
	
	public void saveOrUpdate(T object);
}
